Perception

Eric Hare, Andee Kaplan, Samantha Tyner

May 17, 2016

Cost of an Education

Motivation

  • Why are some plots easier to read than others?

Good Graphics

Graphics consist of:

  • Structure (boxplot, scatterplot, etc.)
  • Aesthetics: features such as color, shape, and size that map other characteristics to structural features

Both the structure and aesthetics should help viewers interpret the information.

Pre-Attentive Features

  • Things that “jump out” in less than 250 ms
  • Color, form, movement, spatial localization

Pre-attentive

Hierarchy of Features

  • Color is stronger than shape
  • Combinations of pre-attentive features are usually not pre-attentive due to interference

Another One

One More

Color

  • Hue: shade of color (red, orange, yellow…)
  • Intensity: amount of color
  • Both color and hue are pre-attentive. Bigger contrast corresponds to faster detection.

More Color

Color is context-sensitive: A and B are the same intensity and hue, but appear to be different.

Aesthetics in ggplot2

Main parameters: alpha, shape, color, size

Your Turn

Find ways to improve the following graphic:

frame <- read.csv("http://heike.github.io/rwrks/02-r-graphics/data/frame.csv")
qplot(x, y, data = frame, shape = g1, colour = g2, size = I(4))

  • Make sure the “oddball” stands out while keeping the information on the groups
  • Hint: interaction combines factor variables

Ordering Variables

Which is bigger?

  • Position: higher is bigger (y), items to the right are bigger (x)
  • Size, Area
  • Color: not always ordered. More contrast = bigger.
  • Shape: Unordered.

Gradients

Qualitative schemes: no more than 7 colors

Quantitative schemes: use color gradient with only one hue for positive values

More Gradients

Quantitative schemes: use color gradient with two hues for positive and negative values. Gradient should go through a light, neutral color (white)

Small objects or thin lines need more contrast than larger areas

RColorBrewer

R package based on Cynthia Brewer’s color schemes (http://www.colorbrewer2.org)

display.brewer.all()

Color in ggplot2

  • Factor variable:
    • scale_colour_discrete
    • scale_colour_brewer(palette = ...)
  • Continuous variable:
    • scale_colour_gradient (define low, high values)
    • scale_colour_gradient2 (define low, mid, and high values)
    • Equivalents for fill: scale_fill_...

Your Turn

  • In the diamonds data, clarity and cut are ordinal, while price and carat are continuous
  • Find a graphic that gives an overview of these four variables while respecting their types
  • Hint: Start with the following code
qplot(carat, price, shape = cut, colour = clarity, data = diamonds)

Facetting

  • A way to extract subsets of data and place them side-by-side in graphics
  • Syntax: facets = row ~ col Use . if there is no variable for either row or column (i.e. facets = . ~ col)
qplot(price, carat, data = diamonds, color = color, facets = . ~ clarity)

Your Turn

The movies dataset contains information from IMDB.com including ratings, genre, length in minutes, and year of release.

movies <- read.csv("http://heike.github.io/rwrks/02-r-graphics/data/MovieSummary.csv")
  • Explore the differences in length, rating, etc. in movie genres over time
  • Hint: use facetting!